#include "demo.h"
#include "debug.h"

FileStorage g_fs_read;
Ptr<SVM> g_svm_load;
Ptr<SVM> g_sentry_load;

int main()
{
#ifdef IMG_TO_VIDEO

	ImgToVideo();

#else
	//设置串口端口号和波特率
	char com[20] = "/dev/TYY_USB";
	SerialPort_Setup(com, 115200);

	//加载自瞄需要的xml文件
	cout << "加载中..." << endl;
	g_fs_read.open("xml/armor.xml", FileStorage::READ, "utf-8");
	g_svm_load = StatModel::load<SVM>("xml/svm.xml");
	g_sentry_load = StatModel::load<SVM>("xml/sentry.xml");
	cout << "加载xml完毕..." << endl;

	//t1 t2 用于图像处理 pthread用于从控制组那边获取字符和能量机关计时
	pthread_t t1, t2;
	pthread_t pthread;

	pthread_create(&t1, NULL, Run1, NULL);
	pthread_create(&pthread, NULL, show_time, NULL);
	
	
#ifdef DEBUG
#else
	pthread_create(&t2, NULL, Run2, NULL);
	pthread_join(t2, NULL);
#endif//DEBUG

	pthread_join(t1, NULL);
	pthread_join(pthread, NULL);


#endif

	return 0;
}


